﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master" Inherits="masterdata_Discounts_Type_List" CodeFile="Discounts_Type_List.aspx.cs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>折扣维护 </title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <table id="wsd_inputtable">
        <tr>
            <td class="tabletitle">
                折扣列表
            </td>
        </tr>
    </table>
    <table id="wsd_listtable" width="100%">
        <tr>
            <td style="width: 100%">
                <asp:UpdatePanel ID="updatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:GridView Width="100%" ID="gvChannelType" runat="server" DataKeyNames="ID" AutoGenerateColumns="False"
                            EmptyDataText="没有可显示的数据." EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                            OnRowDataBound="Grid_RowDataBound" EnableEmptyContentRender="true" 
                            OnSelectedIndexChanged="gvChannelType_SelectedIndexChanged" 
                            AllowPaging="True" onpageindexchanging="gvChannelType_PageIndexChanging" 
                            PageSize="20">
                            <HeaderStyle CssClass="titlist" />
                            <EmptyDataRowStyle Font-Bold="True" HorizontalAlign="Center" />
                            <Columns>
                                <asp:ButtonField CommandName="Select" ButtonType="Link" ControlStyle-Font-Underline="false"
                                    DataTextField="SAPDISCCODE" HeaderText="SAP折扣代码">
                                    <ControlStyle Font-Underline="False" />
                                </asp:ButtonField>
                                <asp:ButtonField CommandName="Select" ButtonType="Link" ControlStyle-Font-Underline="false"
                                    DataTextField="DESCRIPTION" HeaderText="描述">
                                    <ControlStyle Font-Underline="False" />
                                </asp:ButtonField>
                                <asp:TemplateField HeaderText="类型">
                                    <ItemTemplate>
                                        <asp:Label ID="lblType" runat="server" Text='<%# getStringType(DataBinder.Eval(Container.DataItem, "TYPE"))%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="UOMName" HeaderText="单位级别" />
                                <asp:BoundField DataField="DISCOUNT1" HeaderText="折扣1" DataFormatString="{0:N}" />
                                <asp:BoundField DataField="LEVEL1" HeaderText="折扣级别1" DataFormatString="{0:N}" />
                                 <asp:TemplateField HeaderText="检查级别" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center">
                                <ItemTemplate>
                                    <b><%# (bool)Eval("IsCheck") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%></b>
                                </ItemTemplate>
                                     <HeaderStyle HorizontalAlign="Center" />
                                     <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                             <asp:TemplateField HeaderText="有效" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center">
                                <ItemTemplate>
                                    <b><%# (bool)Eval("IsValid") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%></b>
                                </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center" />
                                 <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                               
                            </Columns>
                            <PagerSettings FirstPageText="首页" LastPageText="尾页" Mode="NumericFirstLast" 
                                PageButtonCount="30" />
                            <RowStyle CssClass="evenline" />
                            <AlternatingRowStyle CssClass="oddline" />
                        </asp:GridView>
                    </ContentTemplate>
                    <Triggers>
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table id="wsd_inputtable">
                <tr>
                    <td height="10px" width="100%" class="tabletitle">
                        操作选项
                    </td>
                </tr>
                <tr>
                    <td class="buttonarea">
                        <asp:Button ID="btnNew" runat="server" class="wsd_button2" Text="新  增" OnClick="btnNew_Click" />&nbsp;&nbsp;
                    </td>
                </tr>
            </table>
            <div id="editArea" runat="server" visible="false" class="editArea">
                <table id="wsd_inputtable" style="width: 100%">
                    <tr>
                        <td class="tabletitle" style="width: 100%">
                            编辑
                        </td>
                        <td class="tabletitle">
                            <asp:ImageButton ID="ImageButton1" runat="server" BorderStyle="Solid" CausesValidation="false"
                                Height="18" ImageUrl="~/Resources/Images/0.png" OnClick="btnCancel_Click" Width="18" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            
                            <font color="red" size="2"><b>提示:*为必填项</b></font>
                        </td>
                    </tr>
                    <tr>   
                        <td colspan="2" style="vertical-align:top">
                            <asp:DetailsView ID="DetailsView1"  runat="server" AutoGenerateRows="False" DataSourceID="ObjectDataSource1"
                                DefaultMode="Insert" BorderStyle="None" GridLines="None" OnDataBound="DetailsView1_DataBound">
                                <Fields>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <tr>
                                                <td class="tablefield">
                                                    <span class="keyword">*</span>SAP折扣代码:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server"  ID="txtSAPCode" Text='<%# Bind("SAPDISCCODE") %>' MaxLength="20"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="单折扣代码不能为空!"
                                                        Text="*" ControlToValidate="txtSAPCode"></asp:RequiredFieldValidator>
                                                </td>
                                                <td class="tablefield" style="width: 142px">
                                                    <span class="keyword">*</span>描述:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server"  ID="txtDespic" Text='<%# Bind("DESCRIPTION") %>' MaxLength="30"
                                                        onclick="return txtMINVOLUME4_onclick()"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="描述不能为空!"
                                                        Text="*" ControlToValidate="txtDespic"></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tablefield">
                                                    <span class="keyword">*</span>类型:
                                                </td>
                                                <td>
                                                    <asp:DropDownList ID="ddlType" runat="server" Width="130">
                                                        <asp:ListItem Value="1">数量</asp:ListItem>
                                                        <asp:ListItem Value="2">金额</asp:ListItem>
                                                    </asp:DropDownList>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="类型不能为空!"
                                                        Text="*" ControlToValidate="ddlType"></asp:RequiredFieldValidator>
                                                </td>
                                                <td class="tablefield">
                                                    <span class="keyword">*</span>单位级别:
                                                </td>
                                                <td>
                                                    <span class="keyword">
                                                        <asp:DropDownList ID="ddlUoms" runat="server" Width="130">
                                                        </asp:DropDownList>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="单位级别不能为空!"
                                                            Text="*" ControlToValidate="ddlUoms"></asp:RequiredFieldValidator>
                                                    </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tablefield">
                                                    <span class="keyword">*</span>级别1:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtLEV1" Text='<%# Bind("LEVEL1") %>' MaxLength="10"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="级别1不能为空!"
                                                        Text="*" ControlToValidate="txtLEV1"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="级别应为数字"
                                                        ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtLEV1"
                                                        Text="*"></asp:RegularExpressionValidator>
                                                </td>
                                                <td class="tablefield">
                                                    <span class="keyword">*</span>折扣1:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtDiscount1" Text='<%# Bind("DISCOUNT1") %>' MaxLength="10"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="折扣1不能为空!"
                                                        Text="*" ControlToValidate="txtDiscount1"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="折扣应为数字"
                                                        Text="*" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtDiscount1"></asp:RegularExpressionValidator>
                                                    <asp:CompareValidator runat="server" ID="cpv" ControlToValidate="txtDiscount1" ValueToCompare="1"
                                                        Operator="LessThan" ErrorMessage="折扣应小于1" Text="*"></asp:CompareValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tablefield">
                                                    级别2:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtLEV2" Text='<%# Bind("LEVEL2") %>' MaxLength="10"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ErrorMessage="级别应为数字"
                                                        Text="*" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtLEV2"></asp:RegularExpressionValidator>
                                                </td>
                                                <td class="tablefield">
                                                    折扣2:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtDiscount2" Text='<%# Bind("DISCOUNT2") %>' MaxLength="10"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="折扣应为数字"
                                                        Text="*" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtDiscount2"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tablefield">
                                                    级别3:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtLEV3" Text='<%# Bind("LEVEL3") %>' MaxLength="10"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ErrorMessage="级别应为数字"
                                                        Text="*" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtLEV2"></asp:RegularExpressionValidator>
                                                </td>
                                                <td class="tablefield">
                                                    折扣3:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtDiscount3" Text='<%# Bind("DISCOUNT3") %>' MaxLength="10"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator7" runat="server" ErrorMessage="折扣应为数字"
                                                        Text="*" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtDiscount3"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tablefield">
                                                    级别4:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtLEV4" Text='<%# Bind("LEVEL4") %>' MaxLength="10"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" ErrorMessage="级别应为数字"
                                                        Text="*" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtLEV4"></asp:RegularExpressionValidator>
                                                </td>
                                                <td class="tablefield">
                                                    折扣4:
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtDiscount4" Text='<%# Bind("DISCOUNT4") %>' MaxLength="10"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator8" runat="server" ErrorMessage="折扣应为数字"
                                                        Text="*" ValidationExpression="^(\d{1,3}(,\d\d\d)*(\.\d+)?|\d+(\.\d+)?)$" ControlToValidate="txtDiscount4"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tablefield">
                                                    检查级别:
                                                </td>
                                                <td>
                                                    <asp:CheckBox ID="chkcheck" runat="server" Checked='<%# Bind("IsCheck") %>' />
                                                </td>
                                                <td class="tablefield">
                                                    有效:
                                                </td>
                                                <td>
                                                    <asp:CheckBox ID="chkYesNo" runat="server" Checked='<%# Bind("IsValid") %>' />
                                                </td>
                                            </tr>
                                             <tr>
                                                <td colspan="4">
                                                    <asp:ValidationSummary runat="server" ID="vs" />
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Fields>
                            </asp:DetailsView>
                            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Jumpton.SFA.Server.Entity.DISCOUNTS"
                                InsertMethod="Save" SelectMethod="Load" TypeName="Jumpton.SFA.Server.BusinessRule.MasterData.DisCountManager"
                                UpdateMethod="Save">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="gvChannelType" Name="ID" PropertyName="SelectedValue"
                                        Type="Int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                        </td>
                    </tr>
                </table>
                <table id="wsd_inputtable" style="width: 100%">
                    <tr>
                        <td height="10px" width="100%" class="tabletitle">
                            操作选项
                        </td>
                    </tr>
                    <tr>
                        <td class="buttonarea">
                            <asp:Button ID="btnSave" runat="server" class="wsd_button2" Text="保  存" OnClick="btnSave_Click" />&nbsp;&nbsp;
                            <asp:Button ID="btnCancel" runat="server" class="wsd_button2" Text="取  消" CausesValidation="false"
                                OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
            </div>
            <div id="back" runat="server">
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="DetailsView1" EventName="DataBound" />
            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnCancel" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnNew" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="ImageButton1" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
